home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Media 20
/
PC MEDIA CD20.iso
/
share
/
prog
/
spytrak
/
test.doc
< prev
next >
Wrap
Text File
|
1995-01-05
|
21KB
|
558 lines
To help the user assess the SPY-TRAK qualities, and to compare it
with other disassemblers available on the market, here are provided
some examples:
EXAMPLE 1:
Check if program TEST.EXE is in your SPY-TRAK package.
Check if TEST.ASM - the source code of TEST.EXE, is in the package.
Use an editor, or the enclosed LIST.COM to open TEST.ASM to see its
structure.
See the _TEST procedure:
_Test PROC
ret
Data_3 db 7 dup(?)
_Test ENDP
If you have SOURCER disassembler, or a similar program, you can
get TEST.LST, i.e. disassembled listing of TEST.EXE, which will
show the _TEST procedure as:
sub_1 proc near
8238:0034 C3 retn
sub_1 endp
8238:0035 0005[0000] data_1 dw 5 dup (0)
8238:003F 00 db 0
In both the cases the procedure is limited to the RET instruction.
Full listing of TEST.EXE made by a disassembler such as SOURCER is
provided at the end of this text.
Now, if you installed SPY-TRAK, run tracking of TEST.EXE.
NOTICE: TEST.EXE must be in default directory.
The steps to track TEST.EXE will look as follows:
1SPY
Track program............1
Enter filespec: TEST.EXE <RETURN>
Alt hot key combo (A-Z,0-9,"-","=") default is <Alt_T>
Do you want to change it ? <Y/N>............... [N]
"HOT START" option? <Y/N>............... [Y]
"SINGLE STEP" option ? <Y/N>............... [N]
Stop for "ACTION SCREEN" <Y/N>............... [N]
Follow through till a mispositioned "This is TEST #1. <PRESS ANY
KEY TO CONTINUE>" appears on the screen. Press any key to complete,
then select:
List the track file ....1
When DONE, press <ESC>,<ESC> to exit SPY-TRAK.
To view $TEST.LST, the TEST.EXE listing, type
LIST $TEST.LST <RETURN>
The listing made by SPY-TRAK shall be looking like the one
provided below. Notice the real contents of the _TEST procedure
which is loaded at address locations 4269:0034 through 003B.
The _TEST procedure is filled with instruction by the program itself.
The instructions are encoded in Data_2 in TEST.ASM/TEST.EXE,
or in data_3 in the SOURCER type disassembling.
4269:0000 B86D42 MOV AX,426D
4269:0003 8ED8 MOV DS,AX
4269:0005 FC CLD
4269:0006 BE3000 MOV SI,0030
4269:0009 BF3500 MOV DI,0035
4269:000C 4F DEC DI
4269:000D B90800 MOV CX,0008
4269:0010 AC LODSB
4269:0011 2E CS:
4269:0012 8805 MOV [DI],AL
4269:0014 47 INC DI
4269:0015 E2F9 LOOP 0010
4269:0017 B000 MOV AL,00
4269:0019 3C00 CMP AL,00
4269:001B 740A JE 0027
4269:0027 E80A00 CALL 0034
4269:002A B400 MOV AH,00
4269:002C CD16 INT 16
4269:002E CD08 INT 08
4269:0030 B44C MOV AH,4C
4269:0032 CD21 INT 21
4269:0034 BA0000 MOV DX,0000
4269:0037 B409 MOV AH,09
4269:0039 CD21 INT 21
4269:003B C3 RET
EXAMPLE 2:
Program listing (e.g. $TEST.LST) made by SPAY-TRAK lists only
the instructions which have been executed in the tracked program.
In $TEST.LST, execution of the conditional JE:
4269:001B 740A JE 0027,
when Zero Flag is set (ZF=1,ZR), will result in bypassing instructions
located at 4269:001D through 0025.
However, utilizing options provided in ACTION SCREEN of SPY-TRAK we can
change the flow of program instruction. And that may be helpful for some
hacking attempts.
To test this option on TEST.EXE go through all the steps given in
EXAMPLE 1, except declare YES at:
Stop for "ACTION SCREEN" <Y/N>............... [Y]
Next, input:
IP CODE
FIRST STOP AT = 001B 74 <RETURN>
Complete through.
The ACTION SCREEN shall stop to process the following instruction:
AX=4200 BX=0000 CX=0000 DX=4259 SP=0100 BP=091C SI=0038 DI=003C
DS=426D ES=4259 SS=4271 CS=4269 IP=001B NV UP EI NG ZR NA PE NC
4269:001B 740A JE 0027
Remember Zero Flag is set: ZR, or ZF=1.
Select (1).
Move coursor to ZF. Input 0 - in place of 1. <RETURN>
Select (5).
Follow through till "This is TEST #1. <PRESS ANY KEY TO CONTINUE>",
appears on the screen. Press any key to complete.
Select:
List the track file ....1
Now, the listing ($TEST.LST) is showing memory locations 4269:001D
through 0025:
4269:001D B402 MOV AH,02
4269:001F B700 MOV BH,00
4269:0021 B60A MOV DH,0A
4269:0023 B20F MOV DL,0F
4269:0025 CD10 INT 10
You may repeat the same test selecting (3) and step through the rest
of the program.
EXAMPLE 3:
This example is to show how to track inside of interrupts. We will
get the code of INT 8 called at IP=002E in TEST.EXE. The sequence
is as follows:
1SPY
THREADING Data Editor...4
Tracked FILESPEC:
TEST.EXE <RETURN>
INT 08 <RETURN><RETURN><RETURN><RETURN><RETURN><RETURN><RETURN>
<RETURN><RETURN><RETURN>
IP 002E <RETURN>
<END>
{You may want to check your input. To do so follow the steps:
Tracked FILESPEC:
TEST.EXE <RETURN>
<F2>
<ESC><ESC><ESC> }
Setup menu..............3
INTERRUPT TRACKING......4
INTERRUPTS-> ON <RETURN>
<ESC>
Track program...........1
Enter filespec: TEST.EXE
Alt hot key combo (A-Z,0-9,"-","=") default is <Alt_T>
Do you want to change it ? <Y/N>............... [N]
"HOT START" option? <Y/N>............... [Y]
"SINGLE STEP" option ? <Y/N>............... [N]
Stop for "ACTION SCREEN" <Y/N>............... [N]
Follow through till mispositioned "This is TEST #1. <PRESS ANY
KEY TO CONTINUE>", appears on the screen. Press any key to complete.
Then select:
List the track file ....1
When DONE, press ESC, ESC to exit SPY-TRAK.
To view $TEST.LST, the TEST.EXE listing, type
LIST $TEST.LST
See the listing enclosed at the end of this text to find
the code tracked inside INT 8.
EXAMPLE 4:
This example will show a benefit of forcing CX to 1, to beat
a nasty loop placed in a program you want to hack.
First make the program, using direct assembling by DEBUG:
DEBUG <RETURN>
-A
....:0100 MOV CX,10 <RETURN>
....:0103 PUSH CX <RETURN>
....:0104 NOP <RETURN>
....:0105 POP CX <RETURN>
....:0106 MOV AX,CX <RETURN>
....:0108 PUSH AX <RETURN>
....:0109 LOOP 0104 <RETURN>
....:010B INT 20 <RETURN>
....:010D <RETURN>
-N TEST.COM <RETURN>
-R CX <RETURN>
: D <RETURN>
-Q <RETURN>
1SPY <RETURN>
Setup menu..............3
LOOP TRACKING MODE......2
LOOPS-> OPEN <RETURN>
<ESC>
Enter filespec: TEST.COM <RETURN>
To test TEST.COM go through all the steps given in EXAMPLE 1,
except declare YES at:
Stop for "ACTION SCREEN" <Y/N>............... [Y]
Next, input:
IP CODE
FIRST STOP AT = 0109 E2 <RETURN>
Complete through.
In ACTION SCREEN select 3.
Select 3.
Select 3.
Select 3.
Select 3.
{ This is to walk you one lap, to show how the endless looping is created.
Watch the changing value of CX.}
Select 6.
Select 3.
Select 3.
Documentation of the program execution is recorded in $TEST.TRC.
A printout of $TEST.TRC is provided at the end of this text.
For your information, a similar loop structure you will find in
some programs equipped with antitracking schemes.
WARNING: Don't run TEST.COM outside SPY-TRAK, or using SPY-TRAK
without modifications listed in the steps above.
Or, you will have to break out of the loop by rebooting
your system.
;-----------------------------------------------------------------
:TEST.EXE,
;type SOURCER program made disassembling:
;-----------------------------------------------------------------
test.lst
seg_a segment byte public
assume cs:seg_a , ds:seg_a , ss:stack_seg_c
test proc far
8238:0000 start:
8238:0000 B8 823C mov ax,seg_b
8238:0003 8E D8 mov ds,ax
8238:0005 FC cld
8238:0006 .BE 0030 mov si,offset data_3
8238:0009 .BF 0035 mov di,offset data_1
8238:000C 4F dec di
8238:000D B9 0008 mov cx,8
8238:0010 locloop_1:
8238:0010 AC lodsb
8238:0011 2E: 88 05 mov cs:[di],al
8238:0014 47 inc di
8238:0015 E2 F9 loop locloop_1
8238:0017 B0 00 mov al,0
8238:0019 3C 00 cmp al,0
8238:001B 74 0A je loc_2
8238:001D B4 02 mov ah,2
8238:001F B7 00 mov bh,0
8238:0021 B6 0A mov dh,0Ah
8238:0023 B2 0F mov dl,0Fh
8238:0025 CD 10 int 10h
8238:0027 loc_2:
8238:0027 E8 000A call sub_1
8238:002A B4 00 mov ah,0
8238:002C CD 16 int 16h
8238:002E CD 08 int 8
8238:0030 B4 4C mov ah,4Ch
8238:0032 CD 21 int 21h
test endp
sub_1 proc near
8238:0034 C3 retn
sub_1 endp
8238:0035 0005[0000] data_1 dw 5 dup (0)
8238:003F 00 db 0
seg_a ends
seg_b segment byte public
assume cs:seg_b , ds:seg_b , ss:stack_seg_c
823C:0000 54 68 69 73 20 69 db 'This is TEST # 1. <PRESS ANY KEY'
823C:0006 73 20 54 45 53 54
823C:000C 20 23 20 31 2E 20
823C:0012 3C 50 52 45 53 53
823C:0018 20 41 4E 59 20 4B
823C:001E 45 59
823C:0020 20 54 4F 20 43 4F db ' TO CONTINUE>', 0Dh, 0Ah, '$'
823C:0026 4E 54 49 4E 55 45
823C:002C 3E 0D 0A 24
823C:0030 BA data_3 db 0BAh
823C:0031 00 00 B4 09 CD 21 db 00h, 00h,0B4h, 09h,0CDh, 21h
823C:0037 C3 db 0C3h
823C:0038 0008[00] db 8 dup (0)
seg_b ends
end start
;-----------------------------------------------------------------
; TEST.EXE
; SPY-TRAK made disassembling, including tracking inside INT 8.
; Code located at CS=13D6,3239,F000 has been tracked inside INT 8.
;-----------------------------------------------------------------
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
C:\SPY\TEST.EXE
SPY-TRAK v2.51 Listing
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
═════════════════ entry into tracked part of program
AX=0000 BX=0000 CX=00FF DX=4259 SP=0100 BP=091C SI=0000 DI=0100
DS=4259 ES=4259 SS=4271 CS=4269 IP=0000 NV UP EI NG ZR NA PE NC
4269:0000 B86D42 MOV AX,426D
══════════════════════════════════════════════════════════════════════
══════════════════════ last tracked instruction
AX=4C0D BX=0000 CX=0000 DX=0000 SP=0100 BP=091C SI=0038 DI=003C
DS=426D ES=4259 SS=4271 CS=4269 IP=0032 NV UP EI NG ZR NA PE NC
4269:0032 CD21 INT 21
══════════════════════════════════════════════════════════════════════
Tracked segments number: 4
Tracked code listing:
13D6:▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
13D6:003C E80801 CALL 0147
13D6:0147 50 PUSH AX
13D6:0148 55 PUSH BP
13D6:0149 06 PUSH ES
13D6:014A 2E CS:
13D6:014B 8E060A00 MOV ES,[000A]
13D6:014F 2E CS:
13D6:0150 8B2E1000 MOV BP,[0010]
13D6:0154 B001 MOV AL,01
13D6:0156 26 ES:
13D6:0157 864600 XCHG [BP]+00,AL
13D6:015A 3C00 CMP AL,00
13D6:015C 754F JNE 01AD
13D6:015E 2E CS:
13D6:015F 832E100008 SUB WORD PTR [0010],+08
13D6:0164 26 ES:
13D6:0165 896602 MOV [BP]+02,SP
13D6:0168 26 ES:
13D6:0169 8C5604 MOV [BP]+04,SS
13D6:016C 8BC5 MOV AX,BP
13D6:016E 26 ES:
13D6:016F 8B6E06 MOV BP,[BP]+06
13D6:0172 26 ES:
13D6:0173 394600 CMP [BP]+00,AX
13D6:0176 7542 JNE 01BA
13D6:0178 55 PUSH BP
13D6:0179 8BEC MOV BP,SP
13D6:017B 8B4608 MOV AX,[BP]+08
13D6:017E 5D POP BP
13D6:017F 06 PUSH ES
13D6:0180 17 POP SS
13D6:0183 8BE8 MOV BP,AX
13D6:0185 2E CS:
13D6:0186 8B6E00 MOV BP,[BP]+00
13D6:0189 9C PUSHF
13D6:018A 2E CS:
13D6:018B FF5E00 CALL FAR [BP]+00
13D6:018E 8BEC MOV BP,SP
13D6:0190 26 ES:
13D6:0191 8B6E00 MOV BP,[BP]+00
13D6:0194 26 ES:
13D6:0195 8E5604 MOV SS,[BP]+04
13D6:019C 26 ES:
13D6:019D C6460000 MOV BYTE PTR [BP]+00,00
13D6:01A1 2E CS:
13D6:01A2 892E1000 MOV [0010],BP
13D6:01A6 07 POP ES
13D6:01A7 5D POP BP
13D6:01A8 58 POP AX
13D6:01A9 83C402 ADD SP,+02
13D6:01AC CF IRET
4269:▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
4269:0000 B86D42 MOV AX,426D
4269:0003 8ED8 MOV DS,AX
4269:0005 FC CLD
4269:0006 BE3000 MOV SI,0030
4269:0009 BF3500 MOV DI,0035
4269:000C 4F DEC DI
4269:000D B90800 MOV CX,0008
4269:0010 AC LODSB
4269:0011 2E CS:
4269:0012 8805 MOV [DI],AL
4269:0014 47 INC DI
4269:0015 E2F9 LOOP 0010
4269:0017 B000 MOV AL,00
4269:0019 3C00 CMP AL,00
4269:001B 740A JE 0027
4269:0027 E80A00 CALL 0034
4269:002A B400 MOV AH,00
4269:002C CD16 INT 16
4269:002E CD08 INT 08
4269:0030 B44C MOV AH,4C
4269:0032 CD21 INT 21
4269:0034 BA0000 MOV DX,0000
4269:0037 B409 MOV AH,09
4269:0039 CD21 INT 21
4269:003B C3 RET
F000:▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
F000:0764 0BE4 OR SP,SP
F000:0766 E9ADE5 JMP ED16
F000:901B 50 PUSH AX
F000:901C 0F01E0 SMSW AX
F000:901F A801 TEST AL,01
F000:9021 757A JNE 909D
F000:9023 2E CS:
F000:9024 8A265602 MOV AH,[0256]
F000:9028 0AE4 OR AH,AH
F000:902A 7471 JE 909D
F000:909D 58 POP AX
F000:909E E97A5C JMP ED1B
F000:ECE7 FB STI
F000:ECE8 1E PUSH DS
F000:ECE9 6A40 PUSH 40
F000:ECEB 1F POP DS
F000:ECEC 56 PUSH SI
F000:ECED 57 PUSH DI
F000:ECEE BE6C00 MOV SI,006C
F000:ECF1 BF6E00 MOV DI,006E
F000:ECF4 FF04 INC WORD PTR [SI]
F000:ECF6 7502 JNE ECFA
F000:ECFA 833D18 CMP WORD PTR [DI],+18
F000:ECFD 7512 JNE ED11
F000:ED11 5F POP DI
F000:ED12 5E POP SI
F000:ED13 E94E1A JMP 0764
F000:ED16 7403 JE ED1B
F000:ED18 E900A3 JMP 901B
F000:ED1B 50 PUSH AX
F000:ED1C 52 PUSH DX
F000:ED1D FE0E4000 DEC BYTE PTR [0040]
F000:ED21 750B JNE ED2E
F000:ED2E CD1C INT 1C
F000:ED30 FA CLI
F000:ED31 B020 MOV AL,20
F000:ED33 E620 OUT 20,AL
F000:ED35 5A POP DX
F000:ED36 58 POP AX
F000:ED37 1F POP DS
F000:ED38 CF IRET
F000:FEA5 E93FEE JMP ECE7
;-----------------------------------------------------------------
; TEST.COM, EXAMPLE 4
; SPY-TRAK made disassembling, $TEST.TRC track file
;-----------------------------------------------------------------
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
C:\SPY\TEST.COM
SPY-TRAK v2.51 Listing
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
04-Dec-1994 0: 0:37 <Start>
AX=0000 BX=0000 CX=00FF DX=4259 SP=FFFE BP=091C SI=0100 DI=FFFE
DS=4259 ES=4259 SS=4259 CS=4259 IP=0100 NV UP EI NG ZR NA PE NC
4259:0100 B91000 MOV CX,0010
AX=0000 BX=0000 CX=0010 DX=4259 SP=FFFE BP=091C SI=0100 DI=FFFE
DS=4259 ES=4259 SS=4259 CS=4259 IP=0103 NV UP EI NG ZR NA PE NC
4259:0103 51 PUSH CX
AX=0000 BX=0000 CX=0010 DX=4259 SP=FFFC BP=091C SI=0100 DI=FFFE
DS=4259 ES=4259 SS=4259 CS=4259 IP=0104 NV UP EI NG ZR NA PE NC
4259:0104 90 NOP
AX=0000 BX=0000 CX=0010 DX=4259 SP=FFFC BP=091C SI=0100 DI=FFFE
DS=4259 ES=4259 SS=4259 CS=4259 IP=0105 NV UP EI NG ZR NA PE NC
4259:0105 59 POP CX
AX=0000 BX=0000 CX=0010 DX=4259 SP=FFFE BP=091C SI=0100 DI=FFFE
DS=4259 ES=4259 SS=4259 CS=4259 IP=0106 NV UP EI NG ZR NA PE NC
4259:0106 89C8 MOV AX,CX
AX=0010 BX=0000 CX=0010 DX=4259 SP=FFFE BP=091C SI=0100 DI=FFFE
DS=4259 ES=4259 SS=4259 CS=4259 IP=0108 NV UP EI NG ZR NA PE NC
4259:0108 50 PUSH AX
AX=0010 BX=0000 CX=0010 DX=4259 SP=FFFC BP=091C SI=0100 DI=FFFE
DS=4259 ES=4259 SS=4259 CS=4259 IP=0109 NV UP EI NG ZR NA PE NC
4259:0109 E2F9 LOOP 0104 ;CX=0010, it will always take this
;value if not forced to do otherwise
AX=0010 BX=0000 CX=000F DX=4259 SP=FFFC BP=091C SI=0100 DI=FFFE
DS=4259 ES=4259 SS=4259 CS=4259 IP=0104 NV UP EI NG ZR NA PE NC
4259:0104 90 NOP
AX=0010 BX=0000 CX=000F DX=4259 SP=FFFC BP=091C SI=0100 DI=FFFE
DS=4259 ES=4259 SS=4259 CS=4259 IP=0105 NV UP EI NG ZR NA PE NC
4259:0105 59 POP CX
AX=0010 BX=0000 CX=0010 DX=4259 SP=FFFE BP=091C SI=0100 DI=FFFE
DS=4259 ES=4259 SS=4259 CS=4259 IP=0106 NV UP EI NG ZR NA PE NC
4259:0106 89C8 MOV AX,CX
AX=0010 BX=0000 CX=0010 DX=4259 SP=FFFE BP=091C SI=0100 DI=FFFE
DS=4259 ES=4259 SS=4259 CS=4259 IP=0108 NV UP EI NG ZR NA PE NC
4259:0108 50 PUSH AX
AX=0010 BX=0000 CX=0010 DX=4259 SP=FFFC BP=091C SI=0100 DI=FFFE
DS=4259 ES=4259 SS=4259 CS=4259 IP=0109 NV UP EI NG ZR NA PE NC
4259:0109 E2F9 LOOP 0104 ;point of forcing CX -> 0001
AX=0010 BX=0000 CX=0000 DX=4259 SP=FFFC BP=091C SI=0100 DI=FFFE
DS=4259 ES=4259 SS=4259 CS=4259 IP=010B NV UP EI NG ZR NA PE NC
4259:010B CD20 INT 20